﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VisualTools.Controls;

namespace TestApplication
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1
    {
        public Window1()
        {
            InitializeComponent();

        }

        private void HideAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.HideAll();
        }

        private void ShowAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.ShowAll();
        }

        private void MinimizeAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.MinimizeAll();
        }

        private void MaximizeAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.MaximizeAll();
        }

        private void NormalizeAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.NormalizeAll();
        }

        private void CloseAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.CloseAll(false);
        }

        private void ChangeThemeAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.ChangeTheme(VisualTools.Controls.Theme.Silver);
        }

        private void DisableAll_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.DisableAll(false);
        }

        private void ChangeResizeMode2CanResize_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.ChangeResizeMode(System.Windows.ResizeMode.CanResize);
        }
        private void ChangeResizeMode2NoResize_Click(object sender, RoutedEventArgs e)
        {
            WindowManager.ChangeResizeMode(System.Windows.ResizeMode.NoResize);
        }

        private void OpenNewWindow_Click(object sender, RoutedEventArgs e)
        {
            Window1 newWindow = new Window1();
            newWindow.Show();
        }

        private void OpenNewModalWindow_Click(object sender, RoutedEventArgs e)
        {
            Window1 newWindow = new Window1();
            newWindow.CanClose = false;
            newWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
            newWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            newWindow.IsMovable = false;
            newWindow.ShowDialog();
        }

        private void CloseThisWindow_Click(object sender, RoutedEventArgs e)
        {
            this.CanClose = true;
            this.Close();
        }

        private void ChangeTitleContainerToButton_Click(object sender, RoutedEventArgs e)
        {
            this.Title = null;
            Button b = this.Resources["ButtonResource"] as Button;
            b.Content = titleText.Text;
            this.Title = b;

            toggleMenu.IsChecked = false;
            toggleNormal.IsChecked = false;
        }

        private void ChangeTitleContainerToNormal_Click(object sender, RoutedEventArgs e)
        {
            this.Title = null;
            this.Title = titleText.Text;

            toggleButton.IsChecked = false;
            toggleMenu.IsChecked = false;
        }

        private void ChangeTitleContainerToMenu_Click(object sender, RoutedEventArgs e)
        {
            this.Title = null;
            this.Title = this.Resources["MenuResource"] as Menu;

            toggleButton.IsChecked = false;
            toggleNormal.IsChecked = false;
        }

        private void ChangeThemeToBlue_Checked(object sender, RoutedEventArgs e)
        {
            if (changeThemeAll == null)
                return;
            if (changeThemeAll.IsChecked.Value)
                WindowManager.ChangeTheme(VisualTools.Controls.Theme.Blue);
            else
                this.Theme = VisualTools.Controls.Theme.Blue;
            rbBlack.IsChecked = false;
            rbSilver.IsChecked = false;
        }

        private void ChangeThemeToBlack_Checked(object sender, RoutedEventArgs e)
        {
            if (changeThemeAll.IsChecked.Value)
                WindowManager.ChangeTheme(VisualTools.Controls.Theme.Black);
            else
                this.Theme = VisualTools.Controls.Theme.Black;
            rbBlue.IsChecked = false;
            rbSilver.IsChecked = false;
        }

        private void ChangeThemeToSilver_Checked(object sender, RoutedEventArgs e)
        {
            if (changeThemeAll.IsChecked.Value)
                WindowManager.ChangeTheme(VisualTools.Controls.Theme.Silver);
            else
                this.Theme = VisualTools.Controls.Theme.Silver;
            rbBlack.IsChecked = false;
            rbBlue.IsChecked = false;
        }
    }
}
